// prettier-ignore
import * as envEnc from '@chainlink/env-enc'
import '@nomicfoundation/hardhat-ethers'
import '@nomicfoundation/hardhat-toolbox'
import 'hardhat-deploy'
import 'hardhat-deploy-ethers'
import { HardhatUserConfig } from 'hardhat/config'
import './task'

envEnc.config()

const PRIVATE_KEY = process.env.PRIVATE_KEY!
const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL!
const AMOY_RPC_URL = process.env.AMOY_RPC_URL!

const config: HardhatUserConfig = {
  solidity: {
    version: '0.8.28', // 使用最高版本，向下兼容
    settings: {
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  },
  namedAccounts: {
    firstAccount: {
      default: 0
    }
  },
  networks: {
    sepolia: {
      url: SEPOLIA_RPC_URL,
      accounts: [PRIVATE_KEY],
      chainId: 11155111,
      companionNetworks: {
        destChain: 'amoy'
      }
    },
    amoy: {
      url: AMOY_RPC_URL,
      accounts: [PRIVATE_KEY],
      chainId: 80002,
      companionNetworks: {
        destChain: 'sepolia'
      }
    }
  }
}

export default config
